package com.easybuy.dao.impl;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.easybuy.dao.AdvDao;
import com.easybuy.entity.Adv;

@Repository("advDao")
public class AdvDaoImpl implements AdvDao {

	@Autowired
	private SqlSessionTemplate sqlSession;

	public List<Adv> getList(int position) {
		return sqlSession.getMapper(AdvDao.class).getList(position);
	}

	public void add(Adv adv) {
		sqlSession.getMapper(AdvDao.class).add(adv);
	}

	public Adv getById(int id) {
		return sqlSession.getMapper(AdvDao.class).getById(id);
	}

	public void update(Adv adv) {
		sqlSession.getMapper(AdvDao.class).update(adv);
	}

	public void delete(int id) {
		sqlSession.getMapper(AdvDao.class).delete(id);
	}

	public List<Adv> getbyPosition(int position) {
		return sqlSession.getMapper(AdvDao.class).getbyPosition(position);
	}
}
